package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String[] otherInfo={"老肩巨滑","喜欢唱跳rap篮球","练习时长两年半"};
        Student cxk=new Student("蔡徐坤",20,"未知",otherInfo);
        FileOutputStream fos=new FileOutputStream("cxk.dat");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(cxk);
        /**
         * 对象输出流在序列化对象时，必须保证序列化的对象实现Serializable接口
         */
        System.out.println("写入成功");
        oos.close();
    }
}
